package com.adam.example.newssearches8_2_0.dto;

import com.adam.example.newssearches8_2_0.po.NewsESO;
import lombok.Data;

@Data
public class NewsDTO {

    private long id;
    private String title;
    private String keyword;
    private String content;
    private String url;
    private int reply;
    private String source;
    private String postdate;
    private Double score;

    public static NewsDTO of(NewsESO newsESO, Double score) {
        NewsDTO newsDTO = new NewsDTO();
        newsDTO.setId(newsESO.getId());
        newsDTO.setTitle(newsESO.getTitle());
        newsDTO.setKeyword(newsESO.getKeyword());
        newsDTO.setContent(newsESO.getContent());
        newsDTO.setUrl(newsESO.getUrl());
        newsDTO.setReply(newsESO.getReply());
        newsDTO.setSource(newsESO.getSource());
        newsDTO.setPostdate(newsESO.getPostdate());
        newsDTO.setScore(score);
        return newsDTO;
    }

}
